from flask import Flask
from flask_cors import CORS
from models import db

app = Flask(__name__)

#配置当前应用允许跨域访问
CORS(app)

#配置数据库 URI  chat.db数据库文件默认存储在  instance目录下
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///database.db'

db.init_app(app)

#创建数据库表
with app.app_context():
    db.create_all()

@app.route('/')
def hello_world():  # put application's code here
    return 'Hello World!'


if __name__ == '__main__':
    app.run()
